/*
 * Copyright (c) 2018.
 * http://www.ulabcare.com
 */

package com.mt.roll.core.vo;

import com.mt.roll.core.enums.HttpMethodEnum;
import com.mt.roll.core.enums.ResourceCategoryEnum;
import com.mt.roll.core.validator.constraints.Enum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * <p>
 * 菜单资源视图对象
 * </p>
 *
 * @author jiff
 * @date 2018/11/22
 * @since 1.0
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "菜单资源视图对象", description = "用于查询菜单资源信息")
public class MenuResourceVo extends CommonVo implements PageVo.ConvertVo {

    private static final long serialVersionUID = 1L;

    /**
     * 主键，自增
     */
    @ApiModelProperty(value = "主键", required = true, example = "1")
    private Long id;

    /**
     * 资源ID
     */
    @ApiModelProperty(value = "资源ID", required = true, example = "1")
    @NotNull(message = "资源ID不能为空")
    private Long resourceId;

    /**
     * 服务ID
     */
    @ApiModelProperty(value = "服务ID", required = true, example = "1")
    @NotNull(message = "服务ID不能为空")
    private Long serviceId;

    /**
     * 名称
     */
    @ApiModelProperty(value = "名称", required = true, example = "新增资源")
    @NotBlank(message = "名称不能为空")
    private String name;

    /**
     * 请求地址，可以用于前端ajax调用，后端用于做权限控制
     */
    @ApiModelProperty(value = "url", required = true, example = "/platform-upms/resource/add")
    @NotBlank(message = "请求地址不能为空")
    private String url;

    /**
     * 请求类型：GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE
     */
    @ApiModelProperty(value = "请求类型：GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE", required = true, example = "post")
    @NotBlank(message = "请求方法不能为空")
    @Enum(message = "非法的请求类型", target = {HttpMethodEnum.class})
    private String method;

    /**
     * 子系统:0、common，1、platform，2、partner，3、hospital，4、patient
     */
    @ApiModelProperty("子系统:0、common，1、platform，2、partner，3、hospital，4、patient")
    private Integer subsystem;

    /**
     * 分类:0、common，1、pc，2、app，3、wechat，4、miniapp
     */
    @ApiModelProperty(value = "分类:0、common，1、pc，2、app，3、wechat，4、miniapp", required = true, example = "0")
    @NotNull(message = "资源类型不能为空")
    @Enum(message = "非法的资源类型", target = {ResourceCategoryEnum.class})
    private Integer category;


}
